;;;Turn AutoCAD and AutoLisp into an alarm clock. Use Doslib.
;;;Cannot use AutoCAD while alarm clock is running.
;;;(the idea is to wake yourself after a little sleep during those all nighters).
;;;Be sure not to charge for the time you were sleeping.
;;;Your PC speaker or external speakers must be functional and on.
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe Street
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com
;;;	All rights reserved.
;;;
(defun c:alarm ()
  (cond
    ;if DOSLib is already loaded, return true
    ((not (null dos_about))
      T
    )
    ;if AutoCAD Release 12, 
    ((= (atoi (substr (getvar "acadver") 1 2)) 12)
      (xload "doslib12")
    )
    ;if AutoCAD Release 13, 
    ((= (atoi (substr (getvar "acadver") 1 2)) 13)
      (xload "doslib13" nil)
    )
    ;default message
    (T
      (prompt "DOSLib AutoCAD R12 or R13")
    )
  )
  (setq setime (uint 1 "" "Set Alarm Time" (if setime setime 500)))
  (while
    (and (setq curtime (getvar "cdate"))(/=(fix(*(- curtime(fix curtime))10000))(fix setime)))
    (princ (fix(*(- curtime(fix curtime))100)))
    (princ ":")
    (princ (fix(-(*(- curtime(fix curtime))10000)
                 (*(fix(*(- curtime(fix curtime))100))100)
               )))
    (princ "\010\010\010\010\010")
  )
  (setq count 1)
  (while (and curtime (< count 11))
    (dos_beep 6 1)
    (dos_beep 2 1)
    (setq count (1+ count))
  )
)